/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vetxsoft.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author cuero
 */
@Entity
@Table(name = "CONSULTAS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Consulta.findAll", query = "SELECT c FROM Consulta c"),
    @NamedQuery(name = "Consulta.findByCodigo", query = "SELECT c FROM Consulta c WHERE c.codigo = :codigo"),
    @NamedQuery(name = "Consulta.findByTemperatura", query = "SELECT c FROM Consulta c WHERE c.temperatura = :temperatura"),
    @NamedQuery(name = "Consulta.findByFrecuenciacardiaca", query = "SELECT c FROM Consulta c WHERE c.frecuenciacardiaca = :frecuenciacardiaca"),
    @NamedQuery(name = "Consulta.findByFrecuenciarespiratoria", query = "SELECT c FROM Consulta c WHERE c.frecuenciarespiratoria = :frecuenciarespiratoria"),
    @NamedQuery(name = "Consulta.findByPulso", query = "SELECT c FROM Consulta c WHERE c.pulso = :pulso"),
    @NamedQuery(name = "Consulta.findByDiagnostico", query = "SELECT c FROM Consulta c WHERE c.diagnostico = :diagnostico"),
    @NamedQuery(name = "Consulta.findByTratamiento", query = "SELECT c FROM Consulta c WHERE c.tratamiento = :tratamiento"),
    @NamedQuery(name = "Consulta.findByPasoaseguir", query = "SELECT c FROM Consulta c WHERE c.pasoaseguir = :pasoaseguir")})
public class Consulta extends EntityStored implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "CODIGO")
    private Integer codigo;
    @Size(max = 100)
    @Column(name = "TEMPERATURA")
    private String temperatura;
    @Size(max = 100)
    @Column(name = "FRECUENCIACARDIACA")
    private String frecuenciacardiaca;
    @Size(max = 100)
    @Column(name = "FRECUENCIARESPIRATORIA")
    private String frecuenciarespiratoria;
    @Size(max = 100)
    @Column(name = "PULSO")
    private String pulso;
    @Size(max = 150)
    @Column(name = "DIAGNOSTICO")
    private String diagnostico;
    @Size(max = 150)
    @Column(name = "TRATAMIENTO")
    private String tratamiento;
    @Size(max = 150)
    @Column(name = "PASOASEGUIR")
    private String pasoaseguir;
    @JoinColumn(name = "COD_HISTORIA_CLINICA", referencedColumnName = "CODIGO")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private HistoriaClinica codHistoriaClinica;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codConsulta", fetch = FetchType.LAZY)
    private List<Control> controlList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codConsulta", fetch = FetchType.LAZY)
    private List<Procedimiento> procedimientoList;

    public Consulta() {
    }

    public Consulta(Integer codigo) {
        this.codigo = codigo;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getTemperatura() {
        return temperatura;
    }

    public void setTemperatura(String temperatura) {
        this.temperatura = temperatura;
    }

    public String getFrecuenciacardiaca() {
        return frecuenciacardiaca;
    }

    public void setFrecuenciacardiaca(String frecuenciacardiaca) {
        this.frecuenciacardiaca = frecuenciacardiaca;
    }

    public String getFrecuenciarespiratoria() {
        return frecuenciarespiratoria;
    }

    public void setFrecuenciarespiratoria(String frecuenciarespiratoria) {
        this.frecuenciarespiratoria = frecuenciarespiratoria;
    }

    public String getPulso() {
        return pulso;
    }

    public void setPulso(String pulso) {
        this.pulso = pulso;
    }

    public String getDiagnostico() {
        return diagnostico;
    }

    public void setDiagnostico(String diagnostico) {
        this.diagnostico = diagnostico;
    }

    public String getTratamiento() {
        return tratamiento;
    }

    public void setTratamiento(String tratamiento) {
        this.tratamiento = tratamiento;
    }

    public String getPasoaseguir() {
        return pasoaseguir;
    }

    public void setPasoaseguir(String pasoaseguir) {
        this.pasoaseguir = pasoaseguir;
    }

    public HistoriaClinica getCodHistoriaClinica() {
        return codHistoriaClinica;
    }

    public void setCodHistoriaClinica(HistoriaClinica codHistoriaClinica) {
        this.codHistoriaClinica = codHistoriaClinica;
    }

    @XmlTransient
    public List<Control> getControlList() {
        return controlList;
    }

    public void setControlList(List<Control> controlList) {
        this.controlList = controlList;
    }

    @XmlTransient
    public List<Procedimiento> getProcedimientoList() {
        return procedimientoList;
    }

    public void setProcedimientoList(List<Procedimiento> procedimientoList) {
        this.procedimientoList = procedimientoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Consulta)) {
            return false;
        }
        Consulta other = (Consulta) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vetxsoft.entity.Consulta[ codigo=" + codigo + " ]";
    }
}
